package com.chen.cloudpicture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chen.cloudpicture.model.dto.space.SpaceAddRequest;
import com.chen.cloudpicture.model.dto.space.SpaceQueryRequest;
import com.chen.cloudpicture.model.entity.Space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chen.cloudpicture.model.entity.User;
import com.chen.cloudpicture.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 25480
 * @description 针对表【space(空间)】的数据库操作Service
 * @createDate 2025-07-29 11:45:36
 */
public interface SpaceService extends IService<Space> {


    // 快速构建空间查询条件
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    // 单条VO转换
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    // 分页获取多条空间封装
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 校验空间
     *
     * @param space 空间对象
     * @param isAdd 是否为创建时校验
     */
    void validSpace(Space space, boolean isAdd);

    // 根据空间级别填充空间对象
    void fillSpaceBySpaceLevel(Space space);

    // 创建用户私人空间
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    //校验空间权限
    void checkSpaceAuth(User loginUser, Space space);
}
